<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('客户跟踪查询')" />
	<th:block th:include="include :: list-css" />
	<style type="text/css">
		.layui-tab-content{border: 1px solid;padding: 10px 15px;}
		.layui-tab-title li{font-weight:600}
		.layui-tab{margin:0}
	</style>
</head>
<body>
<div class="mid-content">
	<div class="layui-tab" lay-filter="dhtab">
	  <ul class="layui-tab-title">
	    <li class="layui-this" listUrl="/crm/customer/list">客户资料</li>
	    <li listUrl="/business/bargainin/group/list" listName="销售合同">销售合同</li>
	    <li listUrl="/business/out/group/list" listName="销售出库">销售出库</li>
	    <li listUrl="/business/gatheringbargain/list" listName="合同收款">收款情况</li>
	    <li listUrl="/crm/customer/listarrears">欠款情况</li>
	    <li listUrl="/business/invoiceout/group/list" listName="销售开票">开票情况</li>
	    <li listUrl="/business/expenseaccount/list" listName="费用报销">费用情况</li>
	  </ul>
	  <div class="layui-tab-content">
	    <table class="layui-hide" id="dhtable" lay-filter="ftable"></table>
	  </div>
	</div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: businessJS" />
<script th:inline="javascript">
	/*<![CDATA[*/
	var prefix = ctx + [[${prefix}]],
		gClient=[[${gClient}]],
		gridColumns=[[${gridColumns}]],
		business=[[${business}]];
	/*]]>*/
</script>
<script type="text/javascript">

var gridBodyMap=[];//表格列集合
$(".layui-tab-content").css("border-color",pellucidityTen)
gridBodyMap[0]=gridColumns.gridBody;//客户资料
gridBodyMap[1]=[//销售合同
	{fixed: "left", width: 40,type: "numbers"},
	{width: 150, sort: true, field: "bid", title: "单据编号"},
	{width: 150, sort: true, field: "bUserName", title: "制单人"},
	{width: 150, sort: true, field: "bDeptName", title: "制单部门"},
	{width: 150, sort: true, field: "createTime", title: "创建日期"},
	{width: 150, sort: true, field: "gCName", title: "客户名称"},
	{width: 150, sort: true, field: "vMan", title: "客户联系人"},
	{width: 150, sort: true, field: "bNumb", title: "数量"},
	{width: 150, sort: true, field: "fSumje", title: "合同金额"},
	{width: 150, sort: true, field: "fXsFpsl", title: "销售税率"},
	{width: 150, sort: true, field: "fCkSl", title: "出库数量", totalRow: true},
	{width: 150, sort: true, field: "fThSl", title: "退货数量", totalRow: true},
	{width: 150, sort: true, field: "fKpSl", title: "开票数量", totalRow: true},
	{width: 150, sort: true, field: "fKpSl2", title: "开票保存数量", totalRow: true},
	{width: 150, sort: true, field: "fDkJe", title: "到款金额", totalRow: true},
	{width: 150, sort: true, field: "fDkJe2", title: "到款保存金额", totalRow: true},
	{width: 150, sort: true, field: "fDkBl", title: "到款比例", totalRow: true},
	{width: 150, sort: true, field: "fZbj", title: "质保金"},
	{width: 150, sort: true, field: "dZbQx", title: "质保期限"},
	{width: 150, sort: true, field: "vFkFsName", title: "付款方式"},
	{width: 150, sort: true, field: "vXsLxName", title: "销售类型"},
	{width: 150, sort: true, field: "gUserName", title: "销售员"},
	{width: 150, sort: true, field: "gDeptName", title: "销售部门"},
	{width: 150, sort: true, field: "cidName", title: "所属单位"}
	]
gridBodyMap[2]=[//销售出库
	{fixed: "left", width: 40,type: "numbers"},
	{width: 150, sort: true, field: "bid", title: "出库单号"},
	{width: 150, sort: true, field: "createTime", title: "单据日期"},
	{width: 150, sort: true, field: "vFkFsName", title: "付款方式"},
	{width: 150, sort: true, field: "bNumb", title: "出库数量", totalRow: true},
	{width: 150, sort: true, field: "fSumje", title: "出库金额", totalRow: true},
	{width: 150, sort: true, field: "fDxMl", title: "单项毛利", totalRow: true},
	{width: 100, sort: true, field: "fThSl", title: "退货数量", totalRow: true},
	{width: 100, sort: true, field: "fThSl2", title: "退货保存数量", totalRow: true},
	{width: 100, sort: true, field: "fWThSl", title: "未退货数量", totalRow: true},
	{width: 100, sort: true, field: "fKpSl", title: "开票数量", totalRow: true},
	{width: 100, sort: true, field: "fKpSl2", title: "开票保存数量", totalRow: true},
	{width: 100, sort: true, field: "fWkpSl", title: "未开票数量", totalRow: true}
	]
gridBodyMap[3]=[//收款情况
	{fixed: "left", width: 40,type: "numbers"},
	{width: 150, sort: true, field: "bid", title: "收款单号"},
	{width: 150, sort: true, field: "createTime", title: "单据日期"},
	{width: 150, sort: true, field: "fSumje", title: "收款金额", totalRow: true},
	{width: 150, sort: true, field: "fWskJe", title: "未收款金额", totalRow: true},
	{width: 150, sort: true, field: "fDkJe", title: "已到款金额", totalRow: true},
	{width: 150, sort: true, field: "fDkJe2", title: "到款保存金额", totalRow: true},
	{width: 150, sort: true, field: "fTkJe", title: "退款金额", totalRow: true},
	{width: 150, sort: true, field: "fTkJe2", title: "退款保存金额", totalRow: true}
	]
gridBodyMap[4]=[//欠款情况
	{fixed: "left", width: 40,type: "numbers"},
	{width: 150, sort: true, field: "fCkJe", title: "出库总金额", totalRow: true},
	{width: 150, sort: true, field: "fThJe", title: "退货总金额", totalRow: true},
	{width: 150, sort: true, field: "fXsSk", title: "销售收款总金额", totalRow: true},
	{width: 150, sort: true, field: "fTkJe", title: "退款总金额", totalRow: true},
	{width: 150, sort: true, field: "fYsk", title: "应收款", totalRow: true}
	]
gridBodyMap[5]=[//开票情况
	{fixed: "left", width: 40,type: "numbers"},
	{width: 150, sort: true, field: "bid", title: "开票单号"},
	{width: 150, sort: true, field: "createTime", title: "单据日期"},
	{width: 150, sort: true, field: "dKpRq", title: "开票日期"},
	{width: 150, sort: true, field: "dJpRq", title: "寄票日期"},
	{width: 150, sort: true, field: "vMan", title: "收票人"},
	{width: 150, sort: true, field: "fSumje", title: "开票金额", totalRow: true}
	]
gridBodyMap[6]=[//费用情况
	{fixed: "left", width: 40,type: "numbers"},
	{width: 150, sort: true, field: "bid", title: "报销单号"},
	{width: 150, sort: true, field: "vFyMxName", title: "费用明细"},
	{width: 150, sort: true, field: "vFyXmName", title: "费用项目"},
	{width: 150, sort: true, field: "fSumje", title: "报销金额", totalRow: true},
	{width: 150, sort: true, field: "vZy", title: "摘要"}
	]
var $,layer,form,element,table,wherestr={};
layui.use(['table','form','layer','jquery','element'], function () {
    $ = layui.$, layer = layui.layer, form = layui.form, table = layui.table, element = layui.element;
    $.tablelist.init({//默认加载合同明细
        elem: '#dhtable'
        ,url: prefix + '/list'
   	 	,where: {'gClient':gClient}
    	,even:true
        ,totalRow: true
        ,cols:[gridBodyMap[0]
	 	]
		,height:'full-100'
    });
	//监听排序事件 
    table.on('sort(ftable)', function(obj){
    	$.tablelist.sort('dhtable',obj);
    });
  	//双击行事件：查看单据
	table.on('rowDouble(ftable)', function(obj){
		var tabThis=$('.layui-tab-title').find('.layui-this'),//获取当前选中tab页dom节点
			tName=tabThis.attr('listName'),
			tUrl=tabThis.attr('listUrl');
		if(tName)parent.layui.index.openTabsPage(tUrl.replace('/group','').replace('list','edit?nid=')+obj.data.nid, tName+'('+obj.data.bid+')');
    });
	//监听Tab页
 	element.on('tab(dhtab)', function(data){
 		$.tablelist.init({//表格需重新初始化，重载会继承初始化的参数（不可行）
 			elem: '#dhtable',
 			url:$(this).attr('listUrl'),
 			even:true,
 			where:{'gClient':gClient},
 	        height:'full-100',
 	       	totalRow: true,
			cols:[gridBodyMap[data.index]
			]
 		});
	});
 });
</script>
</body>
</html>